﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace tasktrust.web.Models.Global
{
    public static class HtmlHelperExtension
    {
        public static string LabelEditor(this HtmlHelper helper,string name,string value,string ajaxFunc)
        {
            return string.Empty;
        }
        public static string ImageLink(this HtmlHelper htmlHelper, string imgSrc, string alt, string actionName, string controllerName, object routeValues, object htmlAttributes, object imgHtmlAttributes)
        {
            UrlHelper urlHelper = ((Controller)htmlHelper.ViewContext.Controller).Url; 
            TagBuilder imgTag = new TagBuilder("img"); 
            imgTag.MergeAttribute("src", imgSrc); 
            imgTag.MergeAttributes((IDictionary<string, string>)imgHtmlAttributes, true); 
            string url = urlHelper.Action(actionName, controllerName, routeValues); 

            TagBuilder imglink = new TagBuilder("a"); 
            imglink.MergeAttribute("href", url); 
            imglink.InnerHtml = imgTag.ToString(); 
            imglink.MergeAttributes((IDictionary<string, string>)htmlAttributes, true); 
            return imglink.ToString();
        }
    }
}